package org.example.common.exception;

import lombok.Getter;
import org.example.common.api.IResultCode;

/**
 * 自定义异常类，用于出现业务异常时抛出
 */
@Getter
public class ApiException extends RuntimeException {
    private IResultCode errorCode;

    public ApiException(IResultCode errorCode) {
        super(errorCode.getMessage());
        this.errorCode = errorCode;
    }

    public ApiException(String message) {
        super(message);
    }

    public ApiException(Throwable cause) {
        super(cause);
    }

    public ApiException(String message, Throwable cause) {
        super(message, cause);
    }

}
